import './assets/base.scss'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import axios from 'axios'
const axiosInstance = axios.create({
  baseURL: '/api',
  timeout: 10000
})

import App from './App.vue'
import router from './router'
import store from './store'

const app = createApp(App)

app.use(createPinia())
app.use(router)
app.use(store)

app.use(ElementPlus)

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 挂载axios实例到全局属性
app.config.globalProperties.$axios = axiosInstance

app.mount('#app')
